package d2;
import java.util.*;

public class Day12 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String aa = in.next();
            String bb = in.next();
            Set<Character> set = new HashSet<>();
            for(int i=0;i<bb.length();i++) {
                char ch = bb.charAt(i);
                if(ch != ' ')
                    set.add(ch);
            }
            String ret = new String();
            for(int i=0;i<aa.length();i++) {
                char ch = aa.charAt(i);
                if(!set.contains(ch)) ret += ch+"";
            }
            System.out.println(ret);
        }
    }
    //最长回文子串
    public int longestPalindromeSubseq(String s) {
        int n = s.length();
        if(n==1) return 1;
        int[][] dp = new int[n][n];//以i为结尾的最长子串为回文串
        for(int i=n-1;i>=0;i--) {
            for(int j=i;j<n;j++) {
                if(s.charAt(i)==s.charAt(j)) {
                    if(i==j) dp[i][j]=1;
                    else if(i+1==j) dp[i][j]=2;
                    else dp[i][j]=dp[i+1][j-1] + 2;
                }else {
                    dp[i][j]=Math.max(dp[i+1][j],dp[i][j-1]);
                }
            }
        }
        return dp[0][n-1];
    }
    //地图中的最高点
    public int[][] highestPeak(int[][] isWater) {
        int[] dx = {1,-1,0,0};
        int[] dy = {0,0,1,-1};
        int m=isWater.length,n=isWater[0].length;
        boolean[][] vis = new boolean[m][n];
        Queue<int[]> q = new LinkedList<>();
        for(int i=0;i<m;i++)
            for(int j=0;j<n;j++)
                if(isWater[i][j]==1) {
                    q.add(new int[]{i,j});
                    isWater[i][j]=0;
                    vis[i][j]=true;
                }
                else isWater[i][j]=-1;
        int step=0;
        while(!q.isEmpty()) {
            int[] t = q.poll();
            int a = t[0],b=t[1];
            for(int k=0;k<4;k++) {
                int x=a+dx[k],y=b+dy[k];
                if(x>=0&&x<m&&y>=0&&y<n && !vis[x][y] ) {
                    isWater[x][y]=isWater[a][b]+1;
                    vis[x][y]=true;
                    q.add(new int[]{x,y});
                }
            }
        }
        return isWater;
    }
}
